// pages/category/category.js
Page({
  /**
   * 页面的初始数据
   */
  data: {
    select: 0,
    goodsList: [
      {
        id: 1,
        title: "长安的荔枝",
        image: "https://img2.doubanio.com/view/subject/s/public/s34327482.jpg",
				score: 8.5,
				link: "../category/whm-bookdetail/whm-bookdetail"
      },
      {
        id: 2,
        title: "当我们不再理解世界",
        image: "https://img1.doubanio.com/view/subject/s/public/s34295659.jpg",
				score: 8.6,
				link: "../category/whm-bookdetail/whm-bookdetail"
      },
      {
        id: 3,
        title: "失明症漫记",
        image: "https://img2.doubanio.com/view/subject/s/public/s34269503.jpg",
				score: 8.6,
				link: "../category/whm-bookdetail/whm-bookdetail"
      }
    ],
    imageWidth: "",
    imageHeight: "",
    imageX: "",
    imageY: "",
    wxAppendData: [],
    imageUrl: '',
    btnId: '',
    showImage: false,
    imageStyle: ''

  },    
  /**
   * 选择商品类型
   */ 
  categoryClick: function(event) {
    this.setData({
      select: event.target.id - 1
    })
    // toast提示
    wx.showToast({
      title: event.target.id,
    })
    // 更新接口
  },
  /**
   * 加入购物车
   */
  addToCart: function (event) {
		if(event.target.id==1){
			wx.navigateTo({
				url: '../category/whm-bookdetail/whm-bookdetail',
			})
		}
  }
})